package com.zlzlib.okhttp.xml;

import com.zlzlib.okhttp.utils.OkHttpUtil;
import okhttp3.MediaType;
import okhttp3.RequestBody;

/**
 * 协议的请求根节点
 *
 * @DateTime: 2020/4/27 11:02
 * @Author zlz
 * @Version 1.0
 */
public class BaseEnvelope {


    protected BaseXmlContent root, head, body;

    /**
     * @return 根节点
     */
    public BaseXmlContent getRoot() {
        return root;
    }

    /**
     * @return 头部节点
     */
    public BaseXmlContent getHead() {
        return head;
    }

    /**
     * @return 内容节点
     */
    public BaseXmlContent getBody() {
        return body;
    }

    @Override
    public String toString() {
        return root.toString();
    }

    public RequestBody getRequestBody() {
        return RequestBody.create(toString(), OkHttpUtil.mediaXml());
    }
}
